package com.club.mapper;

import com.club.entity.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author chaochao(vx : zhangfec)
 * @description 针对表【sys_user】的数据库操作Mapper
 * @Entity com.yanzhangzhang.entity.SysUser
 */
public interface SysUserMapper extends BaseMapper<SysUser> {

    /**
     * 根据性别统计性别的数量
     *
     * @return R
     */
    @Select("SELECT\n" +
            "\tif(sex = '0','男','女') AS name,\n" +
            "\tcount( sex ) AS value\n" +
            "FROM\n" +
            "\tsys_user \n" +
            "GROUP BY\n" +
            "\tsex")
    public List<Map<String, Object>> getCountBySex();

}




